package ebcs.database.service.impl.sys;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import ebcs.database.bean.sys.PaParameter;
import ebcs.database.bean.sys.PaParameterExample;
import ebcs.database.bean.sys.PaParameterExample.Criteria;
import ebcs.database.bean.sys.SysCtiy;
import ebcs.database.bean.sys.SysCtiyExample;
import ebcs.database.mybatis.dao.sys.PaParameterMapper;
import ebcs.database.mybatis.dao.sys.SysCtiyMapper;
import ebcs.database.service.sys.IParameterService;
@Service
public class ParameterServiceImpl implements IParameterService {
	
	@Autowired
	private PaParameterMapper dao;
	@Autowired
	private SysCtiyMapper cityDao;
	
	@Cacheable(value="param", key="#p0")
	@Override
	public List<PaParameter> selectParameterByPapaid(String papaid) {
		PaParameterExample example = new  PaParameterExample();
		Criteria criteria = example.createCriteria();
		criteria.andPapaIdEqualTo(papaid);
		return this.dao.selectByExample(example);
	}

	@Cacheable(value="city", key="#p0")
	@Override
	public List<SysCtiy> selectSysCtiyList(String pid) {
		SysCtiyExample exam = new SysCtiyExample();
		SysCtiyExample.Criteria cri = exam.createCriteria();
		cri.andPidEqualTo(Integer.parseInt(pid));
		return this.cityDao.selectByExample(exam);
	}

}
